package name.as3.cmdFrameworks.addins.mediator
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.display.Stage;

import name.as3.cmdFrameworks.interfaces.addins.IMediator;
import name.as3.cmdFrameworks.interfaces.addins.IMediatorAddin;

public class View2CenterAddin extends AbstractMediatorAddin implements IMediatorAddin
{
	/**
	 *
	 */
	public function View2CenterAddin()
	{
		super();
	}
//==================================================================================================
// public
//==================================================================================================
	override public function onAddMediator(contApp:Sprite, obMediator:IMediator):void
	{
		if (contApp != null && obMediator != null)
		{
			var obView:DisplayObject = obMediator.viewer;
			var obStage:Stage = contApp.stage;
			if (contApp.stage)
			{
				obView.x = (obStage.stageWidth - obView.width) * .5;
				obView.y = (obStage.stageHeight - obView.height) * .5;
			}
		}
	}
}
}